<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>XappTool</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            line-height: 1.5;
            padding: 0px;
        }
        .btn {
            display: block;
            width: 100%;
            padding: 12px;
            background: #007bff;
            color: #fff;
            border: none;
            border-radius: 4px;
            font-size: 16px;
            margin: 10px 0;
            cursor: pointer;
        }
        .info {
            margin: 15px 0;
            padding: 15px;
            background: #f8f9fa;
            border-radius: 4px;
            font-size: 14px;
            word-break: break-all;
        }
        .icon{
            width: 80px;
            height: 80px;
            border-radius: 10px;
            display: block;
            margin: 0 auto;
        }
        .banner{
            width: 100%;
            height: 200px;
            border-radius: 4px;
            margin-top: 10px;
        }
        .title{
            text-align: center;
            font-size: 24px;
            margin: 15px 0;
        }
        .name{
            font-size: 18px;
            margin: 10px 0;
            text-align: center;
        }
        .notice{
            text-align: center;
            font-size: 16px;
            margin: 15px 0;
            color: #999;
            background-color: darkkhaki;
            margin-top: 0px;
            height: 40px;
            line-height: 40px;
        }
    </style>
</head>
<body>
    <p class="notice">请用手机浏览器打开</p>
    <h2 class="title">XappTool</h2>
    <div class="info" id="appinfo">
        <image class="icon" id="appicon" src="" mode="scaleToFill"/>
        <image class="banner" id="appbanner" src="" mode="scaleToFill"/>
        <p class="name" id="appname"></p>
    </div>
    <button class="btn" onclick="handleDownload()">下载APP</button>
    <script src="xapptool.js"></script>
    <script>
        let xapptool = new XappTool();
        xapptool.init({app_key: '82e84314c99f8031310569447fdd004f'}).then(function (res) {
            const appinfo = res.appInfo || {};
            const deviceInfo = res.deviceInfo || {};
            document.getElementById('appicon').src = appinfo.icon;
            document.getElementById('appbanner').src = appinfo.banner;
            document.getElementById('appname').innerHTML = appinfo.name;
        });
        // goto app store function
        function handleDownload() {
            xapptool.redirectToStore();
        }
    </script>
</body>
</html> 